<?php
require_once './cc.php';

$name1 = $_REQUEST['username'];

$sql = "SELECT * FROM userinfo WHERE name = '$name1'";

$result = mysqli_query($conn, $sql);

$array = array(
    'code' => 0,
    'data' => false,
    'msg' => '失败',
);

while($data2 = mysqli_fetch_assoc($result)){
    $array2[] = $data2;
    // echo json_encode($array);
}

if($result){
    $array = array(
        'code' => 1,
        'data' => true,
        'data2' =>$array2,
    );

}

echo json_encode($array);
